﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace Hont
{
    public class NodeAStarExample : MonoBehaviour
    {
        public Node beginNode;
        public Node endNode;

        NodeAStar mNodeAstar;


        void OnEnable()
        {
            mNodeAstar = new NodeAStar(new GenericNodeAStarHCost());
            mNodeAstar.Init();

            var path = mNodeAstar.Start(beginNode, endNode);

            for (int i = 1; i < path.Length; i++)
            {
                var path0 = path[i - 1];
                var path1 = path[i];

                Debug.DrawLine(path0.transform.position, path1.transform.position, Color.yellow, 10f);
            }
        }
    }
}
